restructure to library