iterating and cleanup