Add code

Merge in adding of most of the code.