Refacotred dictionary. Added incidence matrix building