Refactoring of server side
Merged with upstream
Merge pull request #2 from aterlyga/doFilter

Server-side refactoring