refactored Images controller