organized pystack with better class structure and calling structure