Adding first base version of code.  Should be working, but needs to be tested.