some refactoring and image upload created