added more comments for training phase