Starting rewrite into plugin architecture