Fixing some merge mistakes that reverted some of rutgerkok's changes in master

See the following commits if anything is still off: 8897a07, 36b0353,
9681427