Final version with number check