refactor atoi