First batch of improvements for #37