Implement most of the cards REST API.
refactor app logic