BS-7901 Refactor and add Unit Tests

- Add tests on Initial values and contingencies fields
- refactor code to fir with test