added a boundary so that images won't go offscreen