core: reimplement operand formatting, add test for that too