refactored pointer usage