Grid generator and PHP cleanup