Fixed variable names and some testing bugs