deep clear refactor