Fixed formatting and more syntax checks. Sorted the code abit