const pointers instead non const, little refactoring