Refactor age category determination. Use do loop to check gender only once.