Move flash related code to a partial