Remove unused locals, clean up cdef formatting