Moved PyObject decls to beginning of functions