Added php comments for logic