Changes to speed up queries