Before introducing slots it was hard to change global variables preserving changes across multiple function calls. This commit implements such possibility. Closes #638.