Code reviewed. Next, integrate comments and then work on serializing out to JS
Having errors with shared pointers.