Finish up and fix #1046