The code hangs if anything other than the specified commands are entered.
Hangs where? This isn't very robust code. It assumes that the end of the serial data is the end of the packet. Since serial data is transmitted relatively slowly, that may not be a valid assumption.
That aside, though, the Comp() function is called to read the serial data, and see if it is a given string. This is not a very good design.
Much better would be to separate the functionality of Comp() into two parts. One part would collect the serial data into an array. The other part would compare that serial data to a string, and return true or false if the strings matched.
That way, the collect function could be called. Then, the compare function could be called for any number of strings.