* One global variable «$j» instead of several local.