Add Apache license headers, small fix ups