Use math instead of magic numbers