code reformat and prepareCheckOutUrl