restructure lib to make components clear in source