Design and calculation fixes.
Tests.