reduced jquery execution time and memory usage