Refactor and clean up unused code and comments.