Made several tweaks to make php work