A re-factoring of some core PHP functions and libraries