some refactoring to fix violations