Moved instantiation outside loop