Refractored the flash code and modified routes