a few design improvements; reworked contributed code