Begining back end

a lot of back end, too much for a regular pull request, but we're learning.