Fully functional implementation, tested with unit tests, Clang, and OCLint. Code/comments need cleanup.