r1664 + more things done, although not really tested yet