Tidied up code. Now using correctly named variables and objects.