Query interface, fixed import issues