Code refactoring and authentication
fixed merge conflict with widget and authentication code