Query interface added. Fix #42 and #43.