Things work passably well

Included some comments, fixed some bugs