refactored and adding injection