Refactoring signin stuff