PHP5 compatibility and syntax overhaul