modified some variable names to be more appropreate