refactoring splitNumbers method