added MainFrame + minor bug fixing