Api refactory