Furthered refactoring

Further inmproved:
- Dependency injection
- Plugin detection