More progress, bug fixes, and unit tests