Rewrote login and stuff to make it more sane