Implemeneted basic user authentication and fix a few things related