Cython stuff thrown in for good measure