Further optimized code