Added tests & refactored service provider