Rewrote GUI library, added error log