minor refactoring to some code units
added error handling test cases
implemented SingletonScopeHandler