Refactor post uploading