Major refactoring. Added unique_ptr for memory management. Removed some unnecessary dynamic memory usage and removed several memory leaks. More pruning to come.