Several big changes: closes #40 #27 #22 #8 #6 other improvements.