New unit test + code refactoring