bunch of clean up and addition of php