Refactored 6th challenge into class and added tests