Merged changes from NB+ and fixed authentication