Added sorting. Changed comments
best memento optimization using sortedness
cleaned logging in handler
cleaned imports