Reformatted and added apache 2.0 copyright notice