Better variable naming, cloning of SelectStatement.
Use ticks to avoid tricky string escapes.
1 less line at a time.
Use assignment for internal sets.
Add BadArgsError.
Add initial documentation.