Removed some library dependencies.
Refactored some stuff and squashed a performance bug.