The code for object and array looks so much similar, they can probably be merged to most extent