Added "mapObject" function to preserve keys when mapping objects