Optimized code a bit