Tidy up the ruler code slightly.