made N an optional argument and exported setattr
fixed examples in docs