Make code more idiomatic