Readding done function with the proper variable definition