m + code deduplication

Signed-off-by: Mattias Andrée <maandree@operamail.com>
code deduplication

Signed-off-by: Mattias Andrée <maandree@operamail.com>