updates and changes to the library -- added comments, fixed a couple bugs