Refactor ApplicationFactory, Controller, Model, and storage classes to improve documentation and api, as well as add optional database support