Updated some apis to be more flexible