Add copyright, clean up comments a bit, remove unnecessary code.