Fixes a couple of issues by using interfaces rather than a specific implementation
Fix some quality flaws