Cleaned code
diff --git a/js/animations.js b/js/animations.js
new file mode 100644
index 0000000..2681a88
--- /dev/null
+++ b/js/animations.js
@@ -0,0 +1,6 @@
+function change_victim(user) {
+	$(".victima").fadeOut(400, function() {
+		$(".victima").load('./ajax/victiminfo.php?userid=' + user.id);
+		$(".victima").fadeIn(400);
+	});
+}
diff --git a/js/utils.js b/js/utils.js
index 42f720a..5f22129 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -17,13 +17,6 @@
 		'success': function(data) {
 			$.notify('Resposta guardada', 'success');
 			console.log(data);
-			
-			if (msg == 'CONF KILL' || msg == 'CONF DEAD') {
-				$(".victima").fadeOut(400, function() {
-					$(".victima").load('./ajax/victiminfo.php?userid=' + user.id);
-					$(".victima").fadeIn(400);
-				});
-			}
 		},
 		'error': function(xhr, status, error) { 
 			$.notify('Error! Torna-ho a intentar o contacta amb l\'Andreu: +34681236024');
@@ -48,9 +41,24 @@
 	return dead || info.mort;
 }
 
-function change_victim(user) {
-	$(".victima").fadeOut(400, function() {
-		$(".victima").load('./ajax/victiminfo.php?userid=' + user.id);
-		$(".victima").fadeIn(400);
-	});
+function update_info(user) {
+	$.ajax({
+		url: "./ajax/checkrequests.php",
+		data: { id: user.id },
+		type: 'GET',
+		success: function(response, status, xhr) {
+			let info = JSON.parse(response);
+			
+			// Check if user is dead
+			if (!user.mort) user.mort = check_requests(info, user);
+			else location.reload();
+			
+			// Check if there has been a change of victim					
+			if (info.quimata != user.quimata) {
+				change_victim(info);
+				user.quimata = info.quimata;
+			}
+			
+			console.log(response);
+	}});	
 }
diff --git a/main.php b/main.php
index 820a18e..a19dbd3 100644
--- a/main.php
+++ b/main.php
@@ -2,12 +2,15 @@
 	<head>
 		<meta charset="UTF-8">
 		<title>Pàgina de l'usuari</title>
+		
 		<link rel="stylesheet" href="./css/basic.css" />
 		<link rel="stylesheet" href="./css/main.css" />
 	
 		<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
 		<script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
+		
 		<script src="./js/utils.js"></script>
+		<script src="./js/animations.js"></script>
 		
 		<?php 
 			require './php/login.php';
@@ -48,24 +51,7 @@
 		<script>
 			$(document).ready(function() {
 				// Set interval of checking
-				let checking = setInterval(function() {
-					$.ajax({
-						url: "./ajax/checkrequests.php",
-						data: { id: user.id },
-						type: 'GET',
-						success: function(response, status, xhr) {
-							let info = JSON.parse(response);
-							if (!user.mort) user.mort = check_requests(info, user);
-							else location.reload();
-														
-							if (info.quimata != user.quimata) {
-								change_victim(info);
-								user = info;
-							}
-							
-							console.log(response);
-					}});
-				}, 1500);
+				let checking = setInterval(function() { update_info(user); }, 1500);
 			});
 		</script>
 	</body>
diff --git a/php/login.php b/php/login.php
index 4dd5ee7..5ab5cdb 100644
--- a/php/login.php
+++ b/php/login.php
@@ -2,5 +2,6 @@
 	require 'utils.php';
 	$user = get_users($_GET['user']);
 	$victim = get_users($user->quimata);
+	
 	if ($user->mort) die("Puto mort de merda");
 ?>
diff --git a/php/request.php b/php/request.php
index ae4e3bb..7ef87ab 100644
--- a/php/request.php
+++ b/php/request.php
@@ -10,26 +10,23 @@
 	$conn->set_charset("utf8");
 	
 	// Do the query
-	$query = "";
-	$query2 = "";
+	$queries = [""];
 	
 	$victimid = "ANY (SELECT quimata FROM users WHERE id=".(int)$_GET['user_id'].")";
 	
-	if ($_GET['msg'] == "REQ KILL") $query = "UPDATE users SET requested=1 WHERE id=".$victimid; // request kill
-	if ($_GET['msg'] == "REQ DEAD") $query = "UPDATE users SET requested=2 WHERE quimata=".(int)$_GET['user_id']; // request dead
+	if ($_GET['msg'] == "REQ KILL") $queries = ["UPDATE users SET requested=1 WHERE id=".$victimid]; // request kill
+	if ($_GET['msg'] == "REQ DEAD") $queries = ["UPDATE users SET requested=2 WHERE quimata=".(int)$_GET['user_id']]; // request dead
+	if ($_GET['msg'] == "DENY REQ") $queries = ["UPDATE users SET requested=0 WHERE id=".(int)$_GET['user_id']]; // deny request
 	if ($_GET['msg'] == "CONF DEAD") {
-		// User gets killed
-		$query = "UPDATE users SET requested=0, quimata=".(int)$_GET['user_quimata']." WHERE quimata=".(int)$_GET['user_id']; // assign new victim to killer
-		$query2 = "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_GET['user_id']; // confirm victim dead/killed
+		$queries = ["UPDATE users SET requested=0, quimata=".(int)$_GET['user_quimata']." WHERE quimata=".(int)$_GET['user_id'], // assign new victim to killer
+				  "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_GET['user_id']]; // confirm victim dead/killed
 	}
-	if ($_GET['msg'] == "DENY REQ") $query = "UPDATE users SET requested=0 WHERE id=".(int)$_GET['user_id']; // deny request
-
 	// Fetch the information of the user
-	if ($query != "" and $result = $conn->query($query)) echo $query;
-	else die("Wrong query: " . $query);
-	if ($query2 != "" and $result = $conn->query($query2)) echo "\n" . $query2;
-	else echo "\nNo second query";
-
+	foreach ($queries as $query) {
+		if ($query != "" and $result = $conn->query($query)) echo $query;
+		else die("Wrong query: " . $query);
+	}
+	
 	// Close connection
 	$conn->close();
 ?>