phptidy, cleaned up and reformatted