Refactor

Refactored image upload.