some works for writing bathc files