Add documentation & commenting

Yeah, really should have added better documentation and commenting
right off the bat, oops.