Cleanup: extract define and define-ns helper fns for reuse