updated codes with Apache 2.0 license