code cleanup and update license

Change-Id: I029e2d0e9135dd3b3a7d7e16860c740a26573451