A little more refactoring of the internals