add a few explanatory comments
fixing bugs --- fully functional now