improvements

Improve test coverage and reduce some string operations.