refactored and put all code in element
removed commented out sections
Merge branch 'refactor-work'