Fixed bugs in index.php, added wrapper function for password validation in Sanity.php.