kill function and tests