clean up to separate functional and imperative files