Added previousPosition checks