updating dispatcher and refactoring