Adding image handling logic.