Minor code clean up and improvements in the re module.