add an untested function and remove copypasted junk