Fix problems with small displays like 80x25, cleanup windowing code