Implemented snap detection