clean up index.pl and separate the header