Move 'misc.c' to more abstract layer.