Add imperative version just for fun.