using swap function instead of list control funciton