draft code to answer queries