Split init_database into two files

cin- and tree-related functions are moved into build_tool.