changed cdef to cpdef for a couple functions