refactoring detailedImage controller so that it’s more reusable