Make notation consistent, fix some small bugs