setStates method parameter changed. high speed threshold and remove obstacle boolean added. see the comments for details