Cleanup ContractBase

- Changed the structure (contract, viewModel, dbModel) to make it
easier to use
- Tests for contracts
- Updated the UI controls