applied consistent formatting
fix global var ordering
complete ui refresh on sigwinch handler
Introduced ncurses for screen management so that terminal can be restored gracefully on exit
removed sanos support (sorry :( ) but I can't maintain it any further
Fixed a few signedness mismatches