make code more idiomatic