Add main train code