two classes for GUI and API

some minor bugs