Mostly implement #37