Never mind about the logic being wrong, I got lost reading the code... Would prefer if you used ternary operators like i said above though