Same functions but now in Cython