Tests updated + php code cleanup.