working out functionality of carousel