Simplified ancestor_at_rank a bit and added additional specs for it.