First commit

Write to mongo and tidied things up :)