refactofing ruby