refactoring (not done yet)