fix warnings, add copyright headers, cosmetics