Small refactor, only arithmetic once