Renaming pyframe to frame and refactoring