Moved inject to a separate function