removed redundant CSRF call in register function and added a bunch of comments