started converting main section to PHP