refactory api structure