some improving of the code