Refactor previous traffic sort commit to use one synchronized block