don't rely on global $ variable