Implemented queryState and added some comments