added unit tests, new objects, and algorithm