Fix/optimize Luhn algorithm

(untested)