added extra time functions; a few parts rewritten; improved unwinding;