Unrevert trim change; add extra check to map normalization
Add small Java tests (from my first-year assignments)