Converted main file to PHP