Making client accept newlines at the end of cmds and cleaning up stuffs.