added code for intercept in model matrix