added support for snapping