Redo of previous pull request. Database and model update

Same as previous pull request. Please see #63 for details.