Found a few issues with my algorithm, should be fixed now. Woo!