Separated GUI code from positioning code. Added GUI quit control.