Order snap node distance Issue #547

Snap closest first
Removed redundant code