Made user model more robust and add comments to explain usage