Merged by hand because of severe conflicts. Closes #158
Merged manually due to insane conflicts. Closes #158