Added file writing and replaced menuBar() with methods