Cythonized more functions. Added tests