cleaned code
removed output
added list copy for safety