unit tests and minor adjustments