first working variant without assertions