Optimized Keystone setup. Minor cleanup