calculate total value and verify if finished
refactored tests
finished