Reimplements instance variable changes from #97 that were removed in #474