Copyright and minor code cleanup