Cleanup based on code analysis