major cleanup of the code base

files have been moved into subdirectories,
unused files have been deleted.
index.php has been neatened.