C++11 fixes, aliasing fixes, etc.

Needs revisiting soon though.