UPDATED: refactoring