restructure code, added post stub