move all the code written by difan into pycheck for future reference