fixed a couple of bugs and tweaked notation