switched code to instances