Updated api and applied apache 2 license.