Understanding And Engineering Surface And Edge Defects Of Transition Metal Dichalcogenides