Arduino forgets sketches after a few minutes? (Power supply?)

You should be able to tidy those up.