Added basic error handling, logout call in model, other shit.