Fixed quality and coverage errors, added tests.