Big PHP cleanup