updated main.py to be fully functional, based on curses