Refactor to remove magic numbers.