split index.php and little improvements