refactored the way cython creates a file