Optimized code to be more compact