Fix the exported interfaces, organize the source code