Api Updates and refactoring