make method return result instead of mutating parameter for clarity (and fixing unused variable warning)