Added error handling
Added password flow