code cleaning, added license headers