refactored some code to pass html5 validation