fixed header $res conflict. improved header and footer.