A general theory of two-dimensional melting: the Gaussian-core model explained