cleaning up remove function