Code Cleanup & Optimization