First draft (only partial solution so far)