Refactored value-mapper into classical middleware