updated apply script