refactoring numeric funcs