Modified PHP script, fixed page order in loading function.