Adds replaceSpaces method and two test cases