adding protection code