Made fixes to php code after testing