Global variables (almost) removed