somewhat, but this turned out to be the cleanest way to do the cleanup