Rewrite to make more bullet proof for sidebars, headers and recalcs