Modified the code