Fixed snapping in resizing operations and moved logic to own method