refactor, more idiomatic, avoiding finishing other fn