Minor refactoring of the value type flags and some additional tweaks
here and there.