Fixed work with pointers, templates added