Fixed all leaking controls

This patch fixes all leaking controls and adds some other optimizations for speed.