Moved private functions inside exports fn.