fix typos in func definitions
add sql rough draft.
resource changes.