Code reformatted using psr0/1 rules.  Removed php memory limit for script.