separate input validation to dedicated method