Finished up and separated out login and registration functions