more stable, fixes in motion detection