Refactored and squashed.