Theory and application of explicitly correlated Gaussians