moved some code snippets into classes for the gui