better version of ex1_6