added empty() and more versatile select()