replace division algorithm