Added preferences GUI + GUI refactoring.