fix some types, minor refactoring

in the commit ecd17c0 `matchingLogic` variable is renamed with `javaBackend` to avoid confusion.

second commit fixes some typos and makes some refactoring.

please note that I couldn't run the test suite because it takes forever to run on my machine.