[refact] export internals. prepare for testing