fixed logic statement issue and deleted lines
added helper method for image logic