Replacements compiles.  Not tested at all so it is surely buggy.
Replacements debugged.  Changed method name to "read" for method on companion object that reads from files.