Added a new login system, rewrote most of the code.