Cleaner code, added a GUI log