Moved all the logic to a new MPScanner class.