refactored devise