second version almost there