Mike

The basic logic has been added in.

The template has not been formatted so it doesn't really look pretty.

also there are some comments with questions so let me know if you have an answer to them, otherwise you can just delete them

Also removed a bunch of whitespace in the files that I looked at.