Variable control of intake and exhaust valves