rewrite to be more standards compliant