Split user addition into a separate function
Added some comments.