refactored CDAL adt to use swap