added user registration check and confirmation and organized the code to users controller