restructure architecture

restructured library architecture.