separating local and global vars

resolves #189