Modified the code slightly.