Injecting impure functions