set stdin to nonblocking mode
on-demand redrawing and stdin reading
fix floating point error and free memory on exit
fix infinite loop in maximizer