updated version because of refactoring