added some subroutines in main, route_ddd dcd dbd dad ect