Modified the first function