sort of working version, working flash. Needs optimisation and reset button