fixed Bug: Swing JFrame was not properly disposing

Added new comment as well and refactored the code