smart cutting+cleanup