Complete rewrite of and , wrapper functions added, see bug #101