updated function to conform with strict mode