Issue 562

**Not ready for merge!** There are still a few remaining issues (we're somehow missing some tests now) but I'd like to see if the tests pass on Travis.