Refactored code and tests fully in scala. Using ScalaTest as the test harness.