Refactoring & Tests of the Scala wrappers