Added flash version and cleaned up code a bit