Add part 3 functionality. Waiting on part 2 to test
Merging additional helper function

Stage 1 and 2 are functional. No memory leak