Cleaned up code and input "module"