input arguments added, residual Bug discovered (not fixed yet...)