moved more of logic.clj into logic. only things remaining are macros -
to be eliminated later