Refactor MainGui, Commenting and Abstraction