code refactoring after hover optimization