MODIFIED: some variables to not be static