This code looks a lot nicer now!