refactor flash and error messages into partials, and also some other stuff