Fixed bug with ratio adjustments, and wrote test for ratio adjustmen. Test passes.