Refactored readQuery and made several small style changes.