changed the way to retrieve local variables