Restored to full functionality

With many refactorings in place