Move remset scan code to its file.