Python rewrite begins to work