Moved functionality over from player.php to index.php