pull cleaning code out separately