Adds ability to specify additional sql condition

This fixes issue #2