I'll look later into using a map instead, and fixing the possible overflow.