reimplement algorithm