refactored to make php pages dynamic, line counts fixed, added 404