added docstring + improved printout + minor changes