refactored everything to generalize image usage