Fixed the input subsystem and added command line parsing.