Refactored a bunch of code, streamlined joint inversion