Minor work, adding const and removing unused variables