Rewrote the doycal stuff for M.A. :-)