Refactored ServiceProvider
Added unit tests