Refactor serial scan to a seperate serial utility file.