modified procedures to allow returning a pointer