implements actions in menubar and cleanup