Implemented a better way to resolve controller dependency