Added class for request plan and added tiny optimization in query execution