Clean up and code analysis