Maritime almost works but sets all ratios to be 4 (TODO)
Some other refactoring and bug fixes