Refactored image uploader