Some refactoring - changed interface of factory and plugin