Added comments, used better parameter names.