Cleaned up code. Added command and input handlers