Cleaning up lib.php and index.php