Clean a bit, maintaining the original algorithm