improvements to L2 distance based model