changed call-by-reference parameters to const