Removed some old code, and used some minor Cython optimisations.