arrange and wrote check logic