upload files code cleanup