* I'm really not sure what it is, but for some reason with the ternary operator the sequence number was ending up wrong - it would end up being 1 twice in a row, at startup it would be 0 when it should have been 1 and other issues. This fixes that
* Also made it atomic
Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>