Making the code bit more idiomatic