Using fgets instead of gets. Removing newline character at the end of the command. Changed the check of empty commands to look for newline or null. Some additional comments.