Refactoring

Created helper functions for __run__ in main gui