backend code

Initial backend code and some of the front end.