add statusbar menu support and do some cleanup/refactoring