Updated optimize DSL to support method invocations.