more idiomatic scala