Finished refactoring

Tweaked all the methods to support the new structure. All previously available
features are back. Though we still could expect some bugs.