Code cleanup for #187