Convert from applet to desktop application and refactoring