refactoring requesthandling