Electronic and optical properties of single-layer MoS2