write remove function