Potentiometer mapping code added, code cleanup and added more comments