Explained algorithms in apq better.