This is how POS does it. Direct copy from that.