Fixes #95, Fixes #94, Fixes #49, Fixes #15

Definitely a hard one, and might be buggy!