Cleaned the code up a bit
Added opening docblock. Contains copyright & license amongst other stuff.