add license and copyright header where missing
added acknowledgement for 3rd-party code
Clean trailing blanks