Changing parts of GUI code for better integration with logic. Also fixing so that repaint and new frames only happen when necessary.