refactored code to allow username for devise