Reimplement map in OOP style and make it reusable object.