Refactored gui, added prefs