Fixed coverage issues, added some more tests - found minor edge case bugs