Incorporating more fixes/changes from @garrensmith and @seanbarclay