more cythonic code