added conditional for global