Analysis of Contact Formation and Surface Layers on Semiconductors