初步完成主函数，not acting so well