Cleaned up the code

Cleaned up the code making it more readable on index.php