Refactored the class into a gem