Refactored and covered tests.