Modified variable names and added documentation.