Making the code more idiomatic / fixing beginner mistakes