Patch 2

Fixed conflicts, and broke the patch into smaller patches.