Added missing license files, cleaned up some unused code and fixed several warnings.