Authentication Library and a bit more.

Authentication library and fixed some issues in specific files.