refactor index.php and forms