Now to build in the logic