Refactor for code climate, create util for test generator