[UPDATE] new market apis, some code cleanup