merge in changes from gcopeland, and some tweaks