Major update with php functions