complete replaceAWithB; make type easy to modify
;