Merge Ian and Moniz branches

Let's get our two sets of code to agree.
fyi, it's sizeof, not sizeOf