Added custom exception,crated separate test file, handled uninitalized database