We present a rewriting method for Datalog-programs which simulates SLD-resolution more closely than the ordinary ``magic set'' method does. This is especially advantageous in the case of tail-recursive programs, but already in non-recursive programs we can often save a number of joins. In contrast to the method of {Ross} [Ros91], we do not only solve the problem of tail-recursion, but try to simulate SLD-resolution as fully as possible. Based on an idea of {Bry} [Bry90], our method can be described in an elegant way by means of a meta-interpreter. An especially nice feature of our approach is that we get many other known optimizations ``for free'' when we simulate SLD-resolution in this way. In contrast to our earlier method [Bra95], we can now handle the full range from a direct simulation of SLD-resolution to the standard ``magic set'' technique (selectable by annotations within the program). We compare the efficiency of SLD-resolution and magic sets within a common framework, explain their main differences, and give hints for choosing between them.