refactored the slide menu code into a type
most of this code is "this"
made $menu and $button parameters