Added function to track movement