Make implementation more idiomatic