Fix dosctrings, reformat code