New to Arduino. Stuck at at errors in code, unable to compile.

It looks like Serial1.remove(1) just removes the next character from the Serial1 input buffer. If so, you can just read that byte and throw it away. Replace "Serial1.remove(1)" with "Serial1.read()".

Pete