snw but fixed a couple things and added doc