made menubar into a function