added authentication and user creation plus logic fixes