updated menu and tidy up code