cleaned up code, fixed GUI