Fixing some GUI components and refactoring.