Clean up step one done

Majority of code is changed to use references and unique_ptrs instead of pointers
Cleaning up code
index on cleanup-attempt: d96e8a3 Cleaning up code
WIP on cleanup-attempt: d96e8a3 Cleaning up code