moved curses library to where input is processed instead
cleaned up code