Adding d1 logic.
Adding w_7 logic.