extract functions from core.clj