lots of refactoring, skip clauses are now added only when needed
added a few simple tests. more tests will be added later