Replaced use of global with procedural.