Cleaned up some code and added copyright text to files.