Minor refactor to make more idiomatic