reconstruct the logic