make main callable from >>>
fixed rounding error, and some debug messages