changed pointers to references