restructure for lib friendly design