Fixed bugs and added user docs

Also added comments