some refactoring on some overly  complex methods