Develop 262

Replace PR #262 due to the size of the patch. 420M vs 16M
This PR combines #224 and #251
cc @gusferguson, @hflynn, @sbesson, @joshmoore