hacking some neat algos