Sanity refactor