Split index.php into several files

Plus, a nice comment header block has been added.