modification + code refactoring