added stopstationdetection function