Increased test coverage, with issues fixed