Refactor username validation.