small improvements, mostly in red.js