changing to more idiomatic Go