Moved most GUI stuff to main.
Only getDistance function remains out of it