Bundle unit test environment & refactoring