The type function was not returning expected results (constructor names), so rewrote it to check for instanceof Array