finished rewroting login