refactor viewmodel for image