Clean up defs, check perms in header