Fixed some small bugs and some additional commenting

Fixed some small bugs and some additional commenting