Make username unique + some refactorings