This looks like it can be easily broken by an overflow :(