code cleanup and update license

Change-Id: I7ba979d757c7b5a7b53a49e395fb8ed4ff7d81ea