Better test coverage and minor changes