refactor stuff and start gui