slightly cleaner code - still suffering from menu dropdown bug