Cut out some unwanted differences with trunk in preparation for merge. Also fixed some warnings, though many remain.