changed to php
spaces to tabs
removed redundant code and fixed validation errors