Moved some functions into lib/init.php.