preparing flash middleware