Replace Empty logic with reflection