refactored pointer to reference