pushing the algorithms I wrote for easier sharing