Performance tweaks and Cleanup