Code refactoring into upload handlers