Refactored flash manager into general flow manager

Signed-off-by: Tom Wright <tom@inflatablecookie.com>