refactoring for web-version