Refactored the Map class to implement the IWriter interface