Operator handling

Still needs testing...
A little refactoring higher up