move cleanup further down