updated username available
finished refactoring sql to active record