added option to get messages from session
added message flashing function for use in templates