optimized code for quicker runtime