Factored out meat of remove to make testable