validation and calculation work