Adding query optimizer. It just does validation for now