Better error handling, better flash messages