Extra bug fixes and updates for #38

Extra bug fixes and updates for #38