Modified the given code