Refactor isbn10 calculation