Add license notice

And, as always, some code reformatting.