done, same algorith as in 018