added injecting function