First commit, updated the code that was got from Aaron by email.