First revision of issue #41.
There's still some stuff to take care of, but I wanna merge first.