use deepEqual instead of custom function
throw if exception in input