reduce code complexity

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

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

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