added more variables to enlighten the understanding of the code