Cython refactoring and new methods.