Moved the internal workings out of the public API