refactor for server version of php