No offense, but Stephen doesnt get PHP that well. Major PHP structure fixes and indentation fixes