Code

Hopefully this is correct. Need to make more changes so I'm commiting these.