created internal scoped pointers to reduce manual memory management