Use smart pointers instead of raw pointers