refactoring devise code