Use const references

In C++ to pass objects that are not going to be modified, we should prefer passing with const references instead of copying it. 

Depends on #1