Moved rest of computation into Cython extension