organize code, change creation api