also could this be moved outside if that checks for type ?

so it would be called in place only, checking if imgTitle is set