refactoring - address the complexity metrics