added flash messages and refactored flags and game messaging into JS