Cleaned up routing code, need to clean up input code.