Finished #25

The library still needs some work, optimization + code refactoring, but
it works and it's much better than before. More flexible, too, and FUN
to write!