sort-of works on gcc-4.8.2, more algorithms