adding support for subqueries

Opening a pull request for subquery support. See discussion at #13.