Rework embedded js and header/footer