fix docstring placements and reduce ns imports scope