new features

* security middleware
* some fixes
* improvements
* refactoring