Added functionality for previous and next arrows