cleaned up PHP a bit