Fredrik's improvements.