Allow using tables and views

pulled out of #31