modifications to optimise for C implementation of nib