Refactor methods to reduce complexity.