added pointers instead of ref