added more comments, renamed variables for the sake of semantic clarity