Added some more comments, fixed some branch implementation errors