Removed unnesessary if statement
+added loop brackets