Changed implementation to use IoC container