Added Apache license notice.
Style fixes and Destroy functions for proper deallocation.