Improved version query