updated to use auto for variable declaration and to use trailing return type in function declaration