Added InputHandler, revised SQL statements