added license header, done some cleanup