setState private vars, documentation

Component edited to use private vars to maintain sate and basic comments added.