Added cache implementation - however got an issue with angular's scope apply