small code refactor, added check if username exists