improved pycheck code