Cleans up implementation a bit. Adds a bit more coverage.