clean up and refactor instruments