Simplify isObject function