Added code to answer queries