code cleanup php stage 3