refactoring methods as Vishnu teaches me scala