refactors number check