Refactoring

refactored to reduce dependencies