updated the main java file for a better use of GUI implementation