Refactoring: restored loved it functionality

And many other minor modifications