adapted tutorial