fixed infinite loop. Was because two functions had same name and called each other recursively