Removed window resizing, only the grid will resize.
Corrected window refreshing. Added error handling. Removed code that wont be used.