Fixes and code coverage

Added code coverage and small fixes discovered by
better testing