moved flash function outside of routes module