removed unnecessary files array copying and manual event firing