mainElement() method was refactored