Optimized the code instead of creating an array, used Direct access