some standard algorithms