Code cleanup and incorporate ODataQuery library