refactoring left menu logic