replace instance vars with structs