New image logic and previous next logic added...