Additional documentation added, variable names tweaked