index and working tree
removed global variables
test fixed