Revision 5

Fixing up some bugs