Complete rewrite to use hook_menu

Complete rewrite to use hook_menu