Optimizing Clause Resolution in Tabled Logic Programs