typical and useful algorithms by ambling